import request from '/@/utils/request';

export function dictDataApi() {
    return {
        // 分頁獲取數據
        getTableData: (data: object) => {
            return request({
                url: 'dict/data/list',
                method: 'post',
                data
            })
        },
        getDictByType: (dictType: String) => {
            return request({
                url: 'dict/data/type/' + dictType,
                method: 'get',
            })
        },
        // 獲取詳情
        getDictDataInfo: (dictId: number) => {
            return request({
                url: 'dict/data/' + dictId,
                method: 'get',
            })
        },
        addRecord: (data: object) => {
            return request({
                url: 'dict/data',
                method: 'post',
                data: data,
            });
        },
        updateRecord: (data: object) => {
            return request({
                url: 'dict/data',
                method: 'put',
                data: data,
            });
        },
        delRecord: (data: object) => {
            return request({
                url: 'dict/data/',
                method: 'delete',
                data: data
            });
        },
    }
}
